package com.example.selfcontrol.controller.Mongo;


import com.example.selfcontrol.config.Response;
import com.example.selfcontrol.entity.Mongo.MongoArticleInfo;
import com.example.selfcontrol.service.Mongo.ArticleInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mongo")
@Api(value = "MongoDB快速查找")
public class ArticleInfoController {
    @Autowired
    private ArticleInfoService articleInfoService ;

    @GetMapping("/info/index")
    @ApiOperation("获取主界面所有info")
    public List<List<MongoArticleInfo>> getInfoIndex() {
        return articleInfoService.getInfoIndex() ;
    }

    @GetMapping("/info/{cid}")
    @ApiOperation("获取分类下的分页数据")
    public List<MongoArticleInfo> CategoryPagination(@PathVariable int cid , int pageNum, int pageSize) {
        return articleInfoService.CategoryPagination(cid,pageNum,pageSize) ;
    }
}
